package SC12Project.pm2.search;

import java.util.Iterator;
import java.util.List;

import org.apache.log4j.Logger;

public class TestSearchEngine
{
    static final Logger logger = Logger.getLogger( TestSearchEngine.class );

    /**
     * @param args
     */
    public static void main( String[] args )
    {
        WSSearchEngineImpl searchEngine = new WSSearchEngineImpl();
        List<ServiceInfo> resultList = searchEngine.search( "Weather" );
        // List<ServiceInfo> resultList = searchEngine.search("test");
        Iterator<ServiceInfo> resultListIterator;
        if ( resultList.size() > 0 )
        {
            System.out.println( "Results Found:" );
            resultListIterator = resultList.iterator();
            int i = 1;
            while ( resultListIterator.hasNext() )
            {
                ServiceInfo result = resultListIterator.next();
                System.out.print( i + ": " );
                System.out.println( "Service Name: " + result.getName() );
                System.out.println( "Service Description: " + result.getDescription() );
                System.out.println( "URL: " + result.getUrl() );
                System.out.println( "//////////////////////////" );
                i++;
            }
        }
        else
            logger.info( "No results found" );
    }

}
